# -*- encoding=utf8 -*-
"""
RedFlag-TC000049   （合拍）下一步检查
（合拍）下一步场景检查
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("--------------------------------（合拍）下一步场景检查--------------------------------------")

"""
进入合拍
点击拍摄按钮
等待3S
点击拍摄按钮（暂停）
点击下一步按钮
断言，这里只能使用框架的断言方法，无法使用封装的方法
点击拍摄按钮
等待4S
点击下一步按钮
断言
"""

shooter.enter_the_production_step()
shooter.click_element(shooting_button)
sleep(3.0)
shooter.click_element(shooting_button)
shooter.click_element(shooting_page_next_button)
shooter.assert_toast_popup(shooting_page_next_button, r"tpl1747062091931.png", "断言失败，并未出现toast弹窗", record_pos=(-0.003, -0.007), resolution=(1224, 2700))
shooter.click_element(shooting_button)
sleep(5.0)
shooter.click_element(shooting_page_next_button)
shooter.assert_element_exists(decoration_page_release_video, "断言失败，没有进入装饰页，并未发现发布按钮")

# 关闭应用
stop_app(UGC_package_name)